//
//  VisitorView.swift
//  SwiftSina
//
//  Created by Jason Ding on 16/8/17.
//  Copyright © 2016年 Jason Ding. All rights reserved.
//

import UIKit

class VisitorView: UIView {
    
    // MARK:- 控件的属性
    @IBOutlet weak var rotationView: UIImageView!
    @IBOutlet weak var iconView: UIImageView!
    @IBOutlet weak var tipLabel: UILabel!
    
    @IBOutlet weak var registerBtn: UIButton!
    @IBOutlet weak var loginBtn: UIButton!

    // MARK:- 提供从xib创建的方法
    class func visitorView() -> VisitorView{
        return NSBundle.mainBundle().loadNibNamed("VisitorView", owner: nil, options: nil).first as! VisitorView
    }

    
    // MARK:- 自定义函数
    func setupVisitorViewInfo(iconName:String, title: String){
        iconView.image = UIImage(named: iconName)
        tipLabel.text = title
        rotationView.hidden = true
    }
    
    func addRotationViewAnim() {
        let rotationAnim = CABasicAnimation(keyPath: "transform.rotation.z")
        
        rotationAnim.fromValue = 0
        rotationAnim.toValue = M_PI * 2
        rotationAnim.repeatCount = MAXFLOAT
        rotationAnim.duration = 20
        rotationAnim.removedOnCompletion = false
        
        rotationView.layer.addAnimation(rotationAnim, forKey: nil)
    }
    
}
